package modbus;

import com.intelligt.modbus.jlibmodbus.Modbus;
import com.intelligt.modbus.jlibmodbus.master.ModbusMasterFactory;
import com.intelligt.modbus.jlibmodbus.tcp.TcpParameters;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;


@Slf4j
public class ModbusMasterTCP extends ModbusMasterMixin {

    public ModbusMasterTCP(@NonNull String host, int port, boolean keepAlive) {
        super(ModbusMasterFactory.createModbusMasterTCP(new TcpParameters(host, port, keepAlive)));
        Modbus.setAutoIncrementTransactionId(true);
    }

    public ModbusMasterTCP(@NonNull String host, int port) {
        this(host, port, false);
    }
}
